import time
import os

class mkDir(object):
    def __init__(self) -> None:
        pass
    
    # 新建文件夹
    def mkdir(self,folderName):
        if not os.path.exists(folderName):
           os.makedirs(folderName)
    
    # 测试建立文件夹
    def doTest(self):
        self.mkdir('.\linkrecord1\\' + 'Log-' + time.strftime('%Y-%m-%d'))
        
class RWfile(object):
    def __init__(self) -> None:
       pass
    
    # 写文件函数 
    def recordFile(Filename,recordStructure,content,FileNotes = ' '):
        stream = open(Filename, 'a+')
        stream.write('******************************************************\n')
        stream.write(FileNotes + '\t')
        stream.write(time.strftime('%m-%d %H:%M:%S'))
        stream.write('\n******************************************************\n')
        recordStructure(stream,content)
        stream.flush()
        stream.close()
    
    # 读文件函数 
    def readFile(Filename,readOperation):
        file = open(Filename, 'r')
        result = readOperation(file)
        return result
    
if __name__ == '__main__':
    mkDir().doTest()